package org.nobody.mallb2c.mallware.dao;

import org.apache.ibatis.annotations.Param;
import org.nobody.mallb2c.mallware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 商品库存
 *
 * @author fancier
 * @email fancier2093@gmail.com
 * @date 2020-07-30 15:47:39
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

  void addStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum);

  Long getSkuStock(Long skuId);

  List<Long> listWareIdHasSkuStock(@Param("skuId") Long skuId);

  Long lockSkuStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("num") Integer num);

  void unlockStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("num") Integer num);
}
